package com.example.shopping.controller.admin;

import com.example.shopping.pojo.Indent;
import com.example.shopping.service.IndentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/admin")
public class OrderFormCon {
    @Autowired
    private IndentService indentService;

    @GetMapping("/orderList")
    @ResponseBody
    public List<Indent>  orderList(){
        List<Indent> list = indentService.list();
        return list;
    }
    @GetMapping("/delOrder/{id}")
    @ResponseBody
    public void delOrder(@PathVariable Integer id){
        indentService.removeById(id);
    }
}
